#include "dominion.h"
#include "dominion_helpers.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int testFullDeckCount(int player, int card, struct gameState *state) {
	int i;
	int count = 0;

	for (i = 0; i < state->deckCount[player]; i++)
	{
		if (state->deck[player][i] == card) count++;
	}

	for (i = 0; i < state->handCount[player]; i++)
	{
		if (state->hand[player][i] == card) count++;
	}

	for (i = 0; i < state->discardCount[player]; i++)
	{
		if (state->discard[player][i] == card) count++;
	}

	return count;
}

void test()
{
	struct gameState g;
	struct gameState * game = &g;
	memset(game, 0, sizeof(struct gameState));
	
	int k[10] = {adventurer, gardens, embargo, village, minion, mine, cutpurse, 
		sea_hag, tribute, smithy};
	initializeGame(4, k, 2, game);
	
	game->discard[0][0] = copper;
	game->discardCount[0]++;
	
	if (testFullDeckCount(0, copper, game) == 8)
		printf("fullDeckCount(): PASS when test counting copper cards\n");
	else
		printf("fullDeckCount(): FAIL when test counting copper cards\n");
	
	if (testFullDeckCount(0, curse, game) == 0)
		printf("fullDeckCount(): PASS when test counting curse cards\n");
	else
		printf("fullDeckCount(): FAIL when test counting curse cards\n");
	
}

int main(int argc, char *argv[])
{
  test();
  return 0;
}
